/* SpanTreeAppC.nc
 * Authors : Mayank Mishra, Prabhakar Ekde,   CSE IIT-Bombay
 */

#include "printf.h"
#include <Timer.h>
#include "SpanTreeMsg.h"
#include "SpanTree.h"

configuration SpanTreeAppC {
}

implementation {
    components MainC;
    components LedsC;
    components SpanTreeC as ST;
    components new TimerMilliC() as TimerSTHBBeacon;
    components new TimerMilliC() as TimerSTHBBeaconRecv;
    components new TimerMilliC() as TimerScanParent;
    components new TimerMilliC() as TimerSeekParent;
    components new TimerMilliC() as TimerRouteTableDisplay;
    
    components ActiveMessageC;
    components new AMSenderC(AM_ST_CONTROL_SYNC) as AMSenderControlSync;
    components new AMSenderC(AM_ST_CONTROL_ASYNC) as AMSenderControlAsync;
    components new AMSenderC(AM_ST_DATA) as AMSenderData;

    components new AMReceiverC(AM_ST_CONTROL_SYNC) as AMReceiverControlSync;
    components new AMReceiverC(AM_ST_CONTROL_ASYNC) as AMReceiverControlAsync;
    components new AMReceiverC(AM_ST_DATA) as AMReceiverData;
    
    components RandomC;

    ST.Boot -> MainC;
    ST.Leds -> LedsC;

    /* Timers */
    ST.TimerSTHBBeacon -> TimerSTHBBeacon;
    ST.TimerSTHBBeaconRecv -> TimerSTHBBeaconRecv;
    ST.TimerScanParent -> TimerScanParent;
    ST.TimerSeekParent -> TimerSeekParent;
    ST.TimerRouteTableDisplay -> TimerRouteTableDisplay;
    
    
    ST.AMSendControlSync -> AMSenderControlSync;
    ST.AMSendControlAsync -> AMSenderControlAsync;
    ST.AMSendData -> AMSenderData;    
    
    ST.AMControl -> ActiveMessageC;
    
    ST.ReceiveControlSync -> AMReceiverControlSync;
    ST.ReceiveControlAsync -> AMReceiverControlAsync;
    ST.ReceiveData -> AMReceiverData;
    
    ST.Random -> RandomC;
}

